<?php

namespace App\Common;


use XWX\Common\H;

class SysEnum
{
    static private $pub_enum = [
        'acc_role' => ['super_admin' => '超级管理员', 'admin' => '管理员'],
        'reply_type' => ['text' => '文本', 'msg' => '图文'],
        'app_type' => ['common' => '通用', 'wx' => '微信'],
    ];


    /**
     *
     * @param $key
     * @return mixed|null
     */
    static function funcGet($key)
    {
        if (H::funcStrIsNullOrEmpty($key))
        {
            return null;
        }

        //key = acc_role.admin 会一层层找
        $keys = explode('.', $key);
        $res = static::$pub_enum;
        foreach ($keys as $k)
        {
            $res = H::funcArrayGet($res, $k);
            if ($res == null)
            {
                break;
            }
        }

        return $res;
    }
}